package com.zcy;

import com.zcy.common.Convert;
import org.apache.dubbo.common.profiler.ProfilerSwitch;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@SpringBootApplication
@EnableDubbo
@EnableScheduling
public class Application implements WebMvcConfigurer {

    public static void main(String[] args) {
//        ProfilerSwitch.setWarnPercent(0);
        ProfilerSwitch.enableDetailProfiler();

        SpringApplication.run(Application.class, args);
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.
                addResourceHandler("/**")
                .addResourceLocations("file:" + Convert.FILE_PATH + "/")
                .resourceChain(false);
    }
}
